﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Text;

namespace MiniFox.Infrastructure
{
    /// <summary>
    /// 
    /// </summary>
    public class ViewColumnCollection : KeyedCollection<string, ViewColumn> //, IColumnMappingCollection
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="columns"></param>
        public void AddRange(IEnumerable<ViewColumn> columns)
        {
            if (columns != null)
                foreach (ViewColumn viewColumn in columns)
                    Add(viewColumn);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        protected override string GetKeyForItem(ViewColumn item)
        {
            return item.Name;
        }

        ///// <summary>
        ///// 
        ///// </summary>
        ///// <param name="sourceColumnName"></param>
        ///// <param name="dataSetColumnName"></param>
        ///// <returns></returns>
        //public IColumnMapping Add(string sourceColumnName, string dataSetColumnName)
        //{
        //    return new ViewColumn(dataSetColumnName)
        //    {
        //        SourceColumn = sourceColumnName
        //    };
        //}

        ///// <summary>
        ///// 
        ///// </summary>
        ///// <param name="dataSetColumnName"></param>
        ///// <returns></returns>
        //public IColumnMapping GetByDataSetColumn(string dataSetColumnName)
        //{
        //    return this[dataSetColumnName];
        //}
        ///// <summary>
        ///// 
        ///// </summary>
        ///// <param name="sourceColumnName"></param>
        ///// <returns></returns>
        //public int IndexOf(string sourceColumnName)
        //{
        //    return base.IndexOf(this[sourceColumnName]);
        //}
        ///// <summary>
        ///// 
        ///// </summary>
        ///// <param name="sourceColumnName"></param>
        //public void RemoveAt(string sourceColumnName)
        //{
        //    base.RemoveAt(this.IndexOf(sourceColumnName));
        //}
        //object IColumnMappingCollection.this[string index]
        //{

        //    get { return this[index]; }
        //    set { this[index] = value; }
        //}

    }
}
